<template>
	<view class="beijingse mainpadding">
		<view class="jfbox">
			<view class="fonweight xiaobai textcenter" style="font-size: 80rpx;">{{userInfo.score}}</view>
			<view class=" xiaobai bigtext margin_top1 textcenter">我的积分</view>
			<view class="flexcenter sbianb margin_top">
				<view class="xbbtn flexcenter margin_right5" @click="jumper('/pages_mypage/zhuanzhang')">转账</view>
				<view class="xbbtn flexcenter" @click="jumper('/pages_mypage/tixian')">提现</view>
			</view>
		</view>
		<view class=" margin_top4" v-if="list.total">
			<view class="dingwei">
				<view class="sanshier fonweight zhonghei">积分明细</view>
				<image class="xiahx" src="../static/image/system/ztxhx.png" mode=""></image>
			</view>
			<view class="mainpadding ffffff radius margin_top">
				<view class="shangbj flexbetween xiahuaxian" v-for="item in list.data" :key="item.id">
					<view class="">
						<view class="ershiba fonweight zhonghei">{{item.memo}}</view>
						<view class="strongtext margin_top1 xiaohui">{{item.createtime_text}}</view>
					</view>
					<view class="flexright">
						<view class="sanshier fonweight xiaocheng">{{item.score}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userInfo: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.init()
			this.userinfomsg()
		},
		methods: {
			userinfomsg() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
					this.pageShow = true
				})
			},
			init(isPage, page) {
				let _this = this
				let url = "/api/user/scoreLog"
				let data = {
					page: page || 1,
					limit: _this.limit,
				}
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			jumper(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.xiahuaxian:last-child {
		padding-bottom: 0;
		border: none;
	}

	.shangbj {
		margin-top: 30rpx;
	}

	.shangbj:first-child {
		margin-top: 0rpx;
	}

	.xiahx {
		width: 124rpx;
		height: 10rpx;
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.sbianb {
		padding-top: 25rpx;
		border-top: 1rpx solid rgba(255, 255, 255, .3);
	}

	.xbbtn {
		width: 194rpx;
		height: 65rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		border: 2rpx solid #FFFFFF;
		color: #FFFFFF;
		border-radius: 10rpx;
	}

	.jfbox {
		background-size: 100% 100%;
		padding: 83rpx 0rpx 23rpx;
		background-image: url('https://solarmini.yuntaiqi.com/uploads/20240109/8273479406cf2db53c5927f8fb7730b5.png');
	}
</style>